import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

/// 通用中文 Footer
CustomFooter commonFooter() {
  return CustomFooter(
    builder: (BuildContext context, LoadStatus? mode) {
      Widget body;
      switch (mode) {
        case LoadStatus.idle:
          body = const Text("上拉加载");
          break;
        case LoadStatus.loading:
          body = const CircularProgressIndicator(strokeWidth: 2);
          break;
        case LoadStatus.failed:
          body = const Text("加载失败，点击重试");
          break;
        case LoadStatus.canLoading:
          body = const Text("松手加载更多");
          break;
        default:
          body = const Text("没有更多数据了");
          break;
      }
      return SizedBox(
        height: 55.0,
        child: Center(child: body),
      );
    },
  );
}

/// 通用中文 Header
ClassicHeader commonHeader() {
  return const ClassicHeader(
    idleText: "下拉刷新",
    releaseText: "松开刷新",
    refreshingText: "正在刷新...",
    completeText: "刷新完成",
    failedText: "刷新失败",
    refreshingIcon: CircularProgressIndicator(strokeWidth: 2),
    releaseIcon: Icon(Icons.arrow_upward),
    idleIcon: Icon(Icons.arrow_downward),
  );
}